//
// Created by sjjmw on 3/24/2022.
//
#include "iostream"
#include "vector"
#include "list"
#include "algorithm"
#include "string"
#include "unordered_map"
#include "cmath"
#include<iomanip>
#include "string"
#include "map"
#include "list"
//核心思路是模拟报数，出队的做标记，扫描的时候跳过
struct Sol{
    void handle(int a,int b){
//        std::vector<int> vec;
        std::vector<char> removed(a);
//        vec.reserve(a);
//        for(int i=0;i<a;i++){
//            vec.push_back(i);
//        }
bool first= true;
        int bs=0;
        int remove_cnt=0;
        int scan_i=0;
        while (remove_cnt<a){
            //找到还在队伍里的
            while(removed[scan_i]){
                scan_i++;
                if(scan_i==a){
                    scan_i=0;
                }
            }
            //报数
            bs++;
            if(bs==b){
                removed[scan_i]=true;
                if(!first){
                    printf(" ");
                }
                first= false;
                printf("%d",scan_i+1);
                remove_cnt++;
                bs=0;
            }
            scan_i++;
            if(scan_i==a){
                scan_i=0;
            }
        }
        printf("\n");
        ;
    }
};
int main(){
    int a,b,c;
//    std::string str;
    while (std::cin>>a>>b){
        Sol().handle(a,b);
    }
    return 0;
}